/**
*      author: Y_Yao
*      created: 2024-11-11 18:26:49
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
int n,b,c;

void solve()
{
    cin >> n >> b >> c;
    if(b == 0)
    {
        if(c >= n)
        {
            cout << n << endl;
            return;
        }
        else if(c == n - 1 || c == n - 2)
        {
            cout << n - 1 << endl;
            return;
        }
        else
        {
            cout << -1 << endl;
            return;
        }
    }
    else if(n == 1)
    {
        if(c == 0)
        {
            cout << 0 << endl;
            return;
        }
        else
        {
            cout << 1 << endl;
            return;
        }
    }
    else
    {
        int ret = 0;
        ret = n - (c < n ? (n - 1 - c) / b + 1 : 0);
        cout << ret << endl;
        return;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}